﻿using Xunit;

namespace WikiMaml.Facts
{
    public class RenderingEngineFacts
    {
        public class Render
        {
            [Fact]
            public void Should_return_immediately_if_the_wiki_content_is_null()
            {
                var engine = new RenderingEngine();

                string result = engine.Render(null);

                Assert.Null(result);
            }

            [Fact]
            public void Should_return_immediately_if_the_wiki_content_is_empty()
            {
                var engine = new RenderingEngine();

                string result = engine.Render(string.Empty);

                Assert.Empty(result);
            }

            [Fact]
            public void Should_render_the_wiki_content_successfully()
            {
                var engine = new RenderingEngine();

                string result = engine.Render("*_wiki_*");

                Assert.Equal("<legacyBold><legacyItalic>wiki</legacyItalic></legacyBold>", result);
            }

            [Fact]
            public void Should_convert_carriage_return_and_new_line_into_only_new_line_prior_to_parsing()
            {
                var engine = new RenderingEngine();

                string result = engine.Render("before\r\nafter");

                Assert.Equal("before\nafter", result);
            }
        }
    }
}
